package com.shushan.pages.bean;

import com.android.net.bean.NetBaseBean;
import com.shushan.home.bean.StarsChildBean;
import com.shushan.home.bean.StarsDataBean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: MyStarsDataBean
 * @Desciption: //我的学贝页面数据bean
 * @author: zhangshihao
 * @date: 2018-05-12
 */
public class MyStarsDataBean extends NetBaseBean {


    public int reset;
    public int reward_reset;

    public StarsChildBean starsChildBean;

    private List<StarsDataBean> starsDataBeanList = new ArrayList<>();

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        reset = jsonObject.optInt("reset",0);
        reward_reset = jsonObject.optInt("reward_reset",0);

        JSONObject childObj = jsonObject.optJSONObject("child");
        starsChildBean = new StarsChildBean();
        starsChildBean.initByJson(childObj);

        JSONArray starsArray = jsonObject.optJSONArray("goods");
        for(int i=0;i<starsArray.length();i++){
            JSONObject jobj = starsArray.optJSONObject(i);
            StarsDataBean starsDataBean = new StarsDataBean();
            starsDataBean.initByJson(jobj);

            starsDataBeanList.add(starsDataBean);
        }

    }

    public List<StarsDataBean> getStarsDataBeanList() {
        return starsDataBeanList;
    }
}
